package com.bdzl.admin.test.controller;

import com.bdzl.admin.test.service.FeignTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/loan/admin/test")
@RefreshScope//实现配置自动更新
public class LoanAdminTestController {
    @Autowired
    FeignTestService feignTestService;

    @Value("${config.info}")
    private String configInfo;
    @Value("${spring.application.name}")
    private String appName;

    /**
     * 获取配置文件信息
     * @return
     */
    @GetMapping("/config/info")
    public String getConfigInfo() {
        return "微服务名称：" + appName + "，微服务描述：" + configInfo;
    }

    /**
     * OpenFeign测试方法，微服务调用
     * @return
     */
    @GetMapping("/openFeignTest")
    public String openFeignTest() {
        return feignTestService.getConfigInfo();
    }

    /**
     * OpenFeign测试方法，微服务调用
     * @return
     */
    @GetMapping("/feigntimeout")
    public String feigntimeout() {
        return feignTestService.feigntimeout();
    }


}


